package com.zjm.behavioral.mediator;

/**
 * 中介者模式
 */
public class ClientTest {
    public static void main(String[] args) {
        // 创建一个中介者
        Mediator mediator = new ConcreteMediator();

        // 创建Alarm并且加入ConcreteMediator对象的集合HashMap
        Alarm alarm = new Alarm(mediator, "Alarm");
        CoffeeMachine coffeeMachine = new CoffeeMachine(mediator, "CoffeeMachine");
        Curtains curtains = new Curtains(mediator, "Curtains");
        TV tv = new TV(mediator, "TV");

        alarm.sendAlarm(0);
        coffeeMachine.finishCoffee();
        alarm.sendAlarm(1);
    }
}
